package cn.maihe.elg.operation.model.enums;

import java.util.Arrays;

/**
 * @Description 保函状态
 * @Author WJH
 * @Date 2021/03/25
 */
public enum GuaranteeStatus {

    PROTECTING(0, "担保中"),
    PENALTY(1, "罚没"),
    WAIT_UNPROTECT(2, "待解保"),
    FINISH_UNPROTECT(3, "已解保"),
    CLAIM(4, "理赔中");


    private int status;
    private String desc;

    GuaranteeStatus(int status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public int getStatus() {
        return status;
    }

    public String getDesc() {
        return desc;
    }

    public static GuaranteeStatus resolve(int status) {
        return Arrays.stream(values()).filter(o -> o.getStatus() == status).findFirst().orElseThrow(() -> new RuntimeException("保函状态值非法[" + status + "]"));
    }
}
